package com.taxi.controller;

import com.taxi.request.ForecastPriceDOT;
import com.taxi.response.ForecastPriceResponse;
import com.taxi.result.Result;
import com.taxi.service.PriceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: aniu
 * @Date: 2023/9/25
 * @ClassName: ForecastPriceController
 * @Description: Write class functionality and purpose here.
 * @Version: 1.0
 */
@RestController
public class ForecastPriceController {
    @Autowired
    private PriceService forecastPriceService;

    @ApiOperation("计算预估价格")
    @PostMapping("/forecast-price")
    public Result forecastPrice(@RequestBody ForecastPriceDOT forecastPriceDOT){
        return forecastPriceService.forecastPrice(forecastPriceDOT);
    }

    @ApiOperation("计算实际价格")
    @PostMapping("/calculate-price")
    public Result calculatePrice(@RequestParam Integer distance,@RequestParam Integer duration,
                                 @RequestParam String cityCode,@RequestParam String vehicleType){
        return forecastPriceService.calculatePrice(distance,duration,cityCode,vehicleType);
    }
}
